﻿@{
    Layout = null;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>登录</title>
    <link href="~/Content/zk/css/common.css" rel="stylesheet" />
    <link href="~/Content/zk/css/user.css" rel="stylesheet" />
</head>
<body class="upage" >
    <div class="uico"><img src="/zhekou/dl/img/default_1.png"></div>
    <div class="pageSignUp" ng-controller="loginCtrl">
        
        <form action="#" method="post" id="loginForm">
            
            <ul>
                <li>
                    <input style="display:none;" type="text" id="user_name" name="user_name" class="itext" />
                    <span>
                        <ins class="icon-user2"></ins>
                        @Html.Hidden("username")
                        <input style="background:#fff;" type="text" id="user_name1" name="user_name" class="itext " placeholder="请输入您的账号" />
                    </span>
                </li>
                <li>
                    <span>
                        <ins class="icon-unlocked"></ins>
                        <input style="background:#fff;" type="password" id="password" name="password" maxlength="20" class="itext" placeholder="请输入您的密码" />
                    </span>
                </li>
                <li class="codeLine">
                    <i class="cdArea">
                        <b class="codeImg"><img src="/verify.html" style="height:40px; vertical-align:top;" /></b>
                        <a class="vcode_refresh" href="javascript:void(0)"><div class="icon_refresh"></div></a>
                    </i>
                    <span>
                        <ins class="icon-drawer2"></ins>
                        <input type="text" maxlength="4" id="verify1" name="verify1" class="itext" placeholder="输入图形验证码">
                    </span>
                </li>
                <li> <a id="btnLogin" class="btn blue" href="javascript:void(0)">登录</a></li>
            </ul>

        </form>
    </div>
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="http://apps.bdimg.com/libs/layer.m/1.5/layer.m.js"></script>
    <script src="http://apps.bdimg.com/libs/jquery.cookie/1.4.1/jquery.cookie.js"></script>
    <script>
   $('body').on('touchmove', function (event) { event.preventDefault(); });
        $(document).ready(function (e) {
            
            $("body").on('keypress', function (e) {
               
                if (e.keyCode == 13) {
                    Login();
                }
            });

            $('#btnLogin').click(function () {

                Login();
            });

        });
        $(function () {
            $('.vcode_refresh, .codeImg').click(function () {
                var $img = $(this).parents('.cdArea').find('img');
                imgSrc = $img.prop('src');
                imgSrc = imgSrc.replace(/\?.+$/, '') + '?' + new Date().getTime();
                $img.prop('src', imgSrc);
            });
        });
        function Login() {
            var username = $('#user_name1').val();
            if (username == '') {
                $('#user_name1').focus();
                layer.open({
                    content: '请输入您的账户',
                    style: 'background:rgba(0,0,0, .6); color:#fff; border:none;',
                    time: 2,
                    shade: false
                });
                return false;
            }
            $("#username").val($('#user_name1').val());
            var password = $('#password').val();
            if (password == '') {
                $('#password').focus();
                layer.open({
                    content: '请您的输入密码',
                    style: 'background:rgba(0,0,0, .6); color:#fff; border:none;',
                    time: 2,
                    shade: false
                });
                return false;
            }
            var data = $('#loginForm').serialize();

            $.post(
                '/postlogin.html',
                data,
                function (res) {
                    if (res.State == true) {
                       // $.cookie("Authorization", res.Datas, new Date(2 * 60 * 3600 * 1000));
                        window.location.href = '/u';
                    }
                    else {
                        layer.open({
                            content: res.Message,
                            style: 'background:rgba(0,0,0, .6); color:#fff; border:none;',
                            time: 2,
                            shade: false
                        });

                        var $img = $('.cdArea').find('img');
                        imgSrc = $img.prop('src');
                        imgSrc = imgSrc.replace(/\?.+$/, '') + '?' + new Date().getTime();
                        $img.prop('src', imgSrc);
                    }
                },
                'json'
            );
        }
    </script>
</body>
</html>
